package api

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
)

type Book struct{}

func (b Book) Hello(context *gin.Context) {
	context.String(http.StatusOK, "hello ,huibenguan")
}

// List
// @Summary 展示所有用户
// @Description 展示所有用户lalala
// @Tags todos
// @Accept json
// @Produce json
// @Param creator query string true "Creator"
// @Success 200 {string} string "ok"
// @Failure 400 {string} string "bad request"
// @Failure 500 {string} string "Internal Server Error"
// @Router /list [get]
func (b Book) List(ctx *gin.Context) {
	ctx.JSON(http.StatusOK, "book List")
}

func (b Book) Add(ctx *gin.Context) {
	ctx.PostForm("id")
	fmt.Println(ctx.DefaultPostForm("name", "jinke"))

	ctx.JSON(http.StatusOK, ctx.PostForm("name"))
}

func (b Book) Delete(ctx *gin.Context) {
	ctx.JSON(http.StatusOK, "book delete")
}
